
import org.omg.PortableInterceptor.INACTIVE;

import java.util.*;

public class haha {
        public static void main(String[] args) {

                Integer[] a = {1,2,3,4,5,6};
                Integer[] b = {2,6,87,8,9};
                Arrays.asList(a);

                List <Integer> list = new ArrayList<>();
                list.addAll(Arrays.asList(a));
                List <Integer> list1 = new ArrayList<>();
                list1.addAll(Arrays.asList(b));

                for (int i = 0; i < b.length; i++) {
                        if (!list.contains(list1.get(i))){
                             list.add(list1.get(i));
                        }
                }
                System.out.println(list);
        }
}

